<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Index Jsp</title>
<jsp:include page="/WEB-INF/jsp/base.jsp" />
<script type="text/javascript" src="<c:url value="/js/jsexcel/excelOperation.js"/>"></script>
<script type="text/javascript">
	//jquery content
	$(function(){
		$("#button3").click(function(){
			button2_test_ajax("button3");
		});
		
		/* $("#file1").change(function(obj){
			if(!obj.files){
				alert("所选的不是文件,即将退出操作");
				return ;
			}
			
			var f = obj.files[0];
			//新建文件读取
	        var reader = new FileReader();
			//加载数据
	        reader.onload = function(e) {
	        	var data = e.target.result;
	        	//将文件读取为二进制字符串
			}
			
		}); */
	});
	
	//button click
	function button_test(){
		var form = document.getElementById('form1');
		form.submit();
	}
	//jquery ajax 
	function button2_test_ajax(str0){
		
		var str = "{'num':1111}"+(str0==null?"":str0);
		console.log("str:"+str);
		$.ajax({
			type:"post",
			url: $ctx+"/jsexcel/excelIn",
			data:str,
			datatype:"json",
			contentType: "application/json; charset=utf-8", 
			async: false,
	        error: function (data) {
	        	console.log("error:"+data);
	        },
	        success: function (data) {
	        	console.log("success:"+data);
	        }
	    }); 
	}
	
</script>
</head>
<body>
Index Jsp<br>
<form id="form1" name="form1" action="<c:url value='/jsexcel/jsActionTurn'/>">
	<input type="button" value="我是测试提交表单的" id="button1" name="button1" onclick="button_test();" />
	<br/>
	<input type="button" value="我是测试ajax post的" id="button2" name="button2" onclick="button2_test_ajax();" />
	<br/>
	<input type="button" value="我是测试function传参的" id="button3" name="button3" />
	<br/><br/>
	<input type="text" id="fileName1" name="fileName1" readonly="readonly" />
	<input type="file" style="width:80%" id="file1" name="file1" value="我是来上传文件的" accept=".xls,.xlsx"/>
	<br/><br/>
	<input type="button" value="跳转 【限制上传文件类型和大小】 页面" id="button4" name="button4" />
	<br/><br/>
	<input type="button" value="跳转 【拖曳文件上传】 页面" id="button5" name="button5" />
	<br/>
</form>
<!-- 	<form id="form2" name="form2" action="#">
		<input class="upload-text-wrap" type="text" id="fileName" name="fileName" readonly="readonly" />
		<div class="upload-wrap anticon" nv-file-drop="" uploader="uploader">
		       <input class="file-ele" type="file" file-model="image" name="image" nv-file-select uploader="uploader" multiple style="width: 687px; "/>
		       <div class="file-open"><em class="icon icon-upload"></em>&nbsp;上传附件</div>    
		</div>
	</form> -->
</body>
</html> 